const log = require('../util/log'),
  chromeMng = require('../mng/chromeMng.20180824')

module.exports = (req, res) => {
  require('../util/service').handlePost(req, res, async (reqObj, resolve) => {
    if (!reqObj.codeText) {
      resolve({
        result: -1,
        msg: '缺少codeText'
      })
      return
    }
    if (!reqObj.codeRequestId) {
      resolve({
        result: -1,
        msg: '缺少codeRequestId'
      })
      return
    }
    if (chromeMng.codeRequestId == reqObj.codeRequestId) {
      chromeMng.codeText = reqObj.codeText
    }
    resolve({
      result: 1
    })
  })
}
